import pandas as pd
import matplotlib.pyplot as plt

data = pd.read_csv('../data/Advertising.csv')
print(data.head())

# 绘制散点图
plt.scatter(data.TV, data.sales, c='blue', marker='s')
plt.scatter(data.radio, data.sales, c='red', marker='v')
plt.scatter(data.newspaper, data.sales, c='orange', marker='o')

# 添加图例，此处要按顺序写 https://www.cnblogs.com/lfri/p/12248629.html
plt.legend(["blue", "red", "orange"])
plt.show()
